Update <array> functions reference#5684
Conversation
|
@Rageking8 : Thanks for your contribution! The author(s) and reviewer(s) have been notified to review your proposed change. |
|
Learn Build status updates of commit d1f2f14: ✅ Validation status: passed
For more details, please refer to the build report. |
PRMerger Results
|
|
@TylerMSFT - Can you review the proposed changes? IMPORTANT: When the changes are ready for publication, adding a #label:"aq-pr-triaged" |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the <array> functions reference documentation to improve readability and completeness. The main purpose is to modernize the documentation with clearer template parameter names, consistent std:: prefixes, and addition of the missing C++20 std::to_array function.
Key changes:
- Modernized template parameter names (
T→Type,N→Size) and addedstd::prefixes throughout - Added documentation for the C++20
std::to_arrayfunction with examples - Added missing
const&&overload for thegetfunction - Reorganized parameter sections with separate "Template parameters" headings
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| docs/standard-library/array.md | Added table entry for the new to_array function and updated metadata |
| docs/standard-library/array-functions.md | Updated all function signatures with modern naming, added complete to_array documentation, and improved structure |
| constexpr T& get(std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr const T& get(const array<T, N>& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T& get(const std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr T&& get(array<T, N>&& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr T&& get(std::array<Type, Size>&& arr) noexcept; | ||
|
|
||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T&& get(const std::array<Type, Size>&& arr) noexcept; |
There was a problem hiding this comment.
The return types use T but the template parameter is named Type. The return types should be Type&, const Type&, Type&&, and const Type&& respectively to match the template parameter name.
| constexpr T& get(std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr const T& get(const array<T, N>& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T& get(const std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr T&& get(array<T, N>&& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr T&& get(std::array<Type, Size>&& arr) noexcept; | ||
|
|
||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T&& get(const std::array<Type, Size>&& arr) noexcept; |
There was a problem hiding this comment.
The return types use T but the template parameter is named Type. The return types should be Type&, const Type&, Type&&, and const Type&& respectively to match the template parameter name.
| constexpr T& get(std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr const T& get(const array<T, N>& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T& get(const std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr T&& get(array<T, N>&& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr T&& get(std::array<Type, Size>&& arr) noexcept; | ||
|
|
||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T&& get(const std::array<Type, Size>&& arr) noexcept; |
There was a problem hiding this comment.
The return types use T but the template parameter is named Type. The return types should be Type&, const Type&, Type&&, and const Type&& respectively to match the template parameter name.
| constexpr T& get(std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr const T& get(const array<T, N>& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T& get(const std::array<Type, Size>& arr) noexcept; | ||
|
|
||
| template <int Index, class T, size_t N> | ||
| constexpr T&& get(array<T, N>&& arr) noexcept; | ||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr T&& get(std::array<Type, Size>&& arr) noexcept; | ||
|
|
||
| template <std::size_t Index, class Type, std::size_t Size> | ||
| constexpr const T&& get(const std::array<Type, Size>&& arr) noexcept; |
There was a problem hiding this comment.
The return types use T but the template parameter is named Type. The return types should be Type&, const Type&, Type&&, and const Type&& respectively to match the template parameter name.
|
Learn Build status updates of commit a1cd597: ✅ Validation status: passed
For more details, please refer to the build report. |
PRMerger Results
|
TylerMSFT
left a comment
There was a problem hiding this comment.
Thank you for adding the function and an example!
|
#sign-off |
Overall changes
std::and "Template parameters" headingsgetconst&&overloadmicrosoft/STLcplusplus/draftstl/inc/array#L852-L853source/containers.tex#L6099-L6100stl/inc/array#L866-L867source/containers.tex#L6103-L6104stl/inc/array#L876-L877source/containers.tex#L6101-L6102stl/inc/array#L890-L891source/containers.tex#L6105-L6106swapnoexceptspecification introduced in C++17 as I need more time to think how to best represent itmicrosoft/STLcplusplus/draftstl/inc/array#L771-L772source/containers.tex#L6083-L6084to_arraystd::to_arrayfunctionmicrosoft/STLcplusplus/draftstl/inc/array#L828-L829source/containers.tex#L6087-L6088stl/inc/array#L837-L838source/containers.tex#L6089-L6090